import tkinter as tk
# 导入消息盒子的控件
from tkinter import messagebox

class MyWindow():
    def __init__(self,app):
        self.app = app
        self.app.title("Hello tkinter!")
        self.app.geometry("%dx%d+%d+%d" % (200,200,200,200))
        # 使用1x1单位图 (以像素为单位)
        self.px = tk.PhotoImage(width=1, height=1)


        self.label = tk.Label(self.app,text="一下内容是按钮",font=('黑体',20),
                              image=self.px,compound="c",
                              width=200,height=50)
        self.label.pack()

        # Button组件中可以通过width和height设置宽高，但是宽高的单位是有问题的
        self.button = tk.Button(self.app,text="按钮",font=('华文彩云',20),
                                image=self.px,compound="c",
                                width=50,height=50)
        self.button.pack()

if __name__ == '__main__':
    app = tk.Tk()
    window = MyWindow(app)
    app.mainloop()